--dht11
module("dht11", package.seeall);

TMR_dht11 = 0
pin = 2

print("http get dht11")
url = "http://103.13.221.30/weixin"
--url = "http://1.hygxm1.applinzi.com/weixin"


function data_Update(TMR_dht11, dht11_IO, Time)
	--定时更新一次温度信息
	tmr.alarm(TMR_dht11, Time, tmr.ALARM_AUTO, function()
		status, temp, humi, temp_dec, humi_dec = dht.read(dht11_IO)
		if status == dht.OK then
			http.get(url.."/GET.php?temp="..temp.."&humi="..humi, nil, function(code, data)
				if (code > 0) then
					print("DHT Temperature:"..temp..";".."Humidity:"..humi)
				end
			end)
		end
	end)
end